<template>
  <div class="app-container">
    <Ht-search-form
      v-show="showSearch"
      :advOptions="[]"
      :dictMap="dictMap"
      :formOptions="formOptions"
      :outputQueryParams="queryParams"
      :queryParams="queryParams"
      :defaultEventKey="defaultEventKey"
      :labelWidth="75"
    ></Ht-search-form>

    <ht-table
      :defaultEventKey="defaultEventKey"
      ref="dataTableEntry"
      :dictMap="dictMap"
      :multi-select="false"
      :opButtonList="opButtonList"
      :queryParams="queryParams"
      :reqConfig="regConfig"
      :showSerialNumber="false"
      :tableBindColumns="tableBindColumns"
    >
      <template v-slot:operate>
        <el-table-column align="left" fixed="right" label="操作" width="120">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  doFunc: () => {
                    handleAction('detail', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>

    <!-- 添加或修改弹出框 -->
    <el-dialog
      :close-on-click-modal="false"
      :title="title381"
      :visible.sync="open381"
      center
      v-if="open381"
      append-to-body
      width="1024px"
    >
      <el-form ref="detailForm381" :model="detailForm381" :rules="rules" label-width="140px">
        <div slot="header" class="label-header-msg">
          <span></span>
        </div>
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>基本信息</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="交易流水号" prop="id">
                <el-input v-model="detailForm381.id" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="报文标识号" prop="pkgId">
                <el-input v-model="detailForm381.pkgId" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="CPG日期" prop="vdate">
                <el-date-picker
                  v-model="detailForm381.vdate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="工作日期" prop="workdate">
                <el-date-picker
                  v-model="detailForm381.workdate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="来往账标识" prop="drct">
                <el-select style="width: 100%" v-model="detailForm381.drct" placeholder="来往账标识" :disabled="true">
                  <el-option
                    v-for="dict in dictMap.DRCTCODE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="货币种类" prop="sucCurcd">
                <el-input v-model="detailForm381.sucCurcd" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="成功总金额" prop="sucAmount">
                <ht-amount-input
                  v-model="detailForm381.sucAmount"
                  placeholder="成功总金额"
                  :disable="true"
                ></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="成功总笔数" prop="sucNumber">
                <el-input v-model="detailForm381.sucNumber" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>原交易信息</span>
          </div>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="原报文标识号" prop="oriPkgId">
                <el-input v-model="detailForm381.oriPkgId" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="原批序号" prop="oriBatchNo">
                <el-input v-model="detailForm381.oriBatchNo" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="货币种类" prop="oriCurcd">
                <el-input v-model="detailForm381.oriCurcd" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="原总金额" prop="oriTotAmount">
                <ht-amount-input
                  v-model="detailForm381.oriTotAmount"
                  placeholder="原总金额"
                  :disable="true"
                ></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="原转发日期" prop="oriNpcSndDate">
                <el-date-picker
                  v-model="detailForm381.oriNpcSndDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="原回执期限" prop="oriReturnDate">
                <el-input v-model="detailForm381.oriReturnDate" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="原总笔数" prop="oriTotNumber">
                <el-input v-model="detailForm381.oriTotNumber" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="原业务类型" prop="oriBizTypeCode">
                <el-select v-model="detailForm381.oriBizTypeCode" placeholder="业务类型" disabled>
                  <el-option
                    v-for="dict in dictMap.BIZ_TYPE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>收款人信息</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="收款行行号" prop="payeeBrno">
                <el-input v-model="detailForm381.payeeBrno" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="收款行行名" prop="payeeBrname">
                <el-input v-model="detailForm381.payeeBrname" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="收款人账号" prop="payeeActno">
                <el-input v-model="detailForm381.payeeActno" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="收款人名称" prop="payeeName">
                <el-input v-model="detailForm381.payeeName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <ht-table
              ref="dataTable"
              :multi-select="false"
              :showSerialNumber="false"
              :dictMap="dictMap"
              :queryParams="queryParams381"
              :tableBindColumns="tableBindColumns381"
              :opButtonList="opButtonList"
              :reqConfig="regConfig381"
              :showRightToolbar="false"
            />
          </el-row>
        </el-card>
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>NPC处理信息</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="处理码" prop="procCode">
                <el-select
                  style="width: 100%"
                  v-model="
                    detailForm381.procCode === null || detailForm381.procCode === undefined
                      ? ''
                      : detailForm381.procCode + '-' + detailForm381.procCodeDesc
                  "
                  placeholder="处理码"
                  :disabled="true"
                ></el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="拒绝信息" prop="rejectInfo">
                <el-input v-model="detailForm381.rejectInfo" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="轧差日期" prop="chkDate">
                <el-date-picker
                  v-model="detailForm381.chkDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="轧差场次" prop="chkRound">
                <el-input v-model="detailForm381.chkRound" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="清算日期" prop="clrDate">
                <el-date-picker
                  v-model="detailForm381.clrDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span></span>
          </div>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="备注" prop="remarks1">
                <el-input type="textarea" v-model="detailForm381.remarks1" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="中心状态" prop="procStatus">
                <el-select
                  style="width: 100%"
                  v-model="detailForm381.procStatus"
                  placeholder="中心状态"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.PROCESSSTATUS"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="通讯状态" prop="status">
                <el-select style="width: 100%" v-model="detailForm381.status" placeholder="通讯状态" :disabled="true">
                  <el-option
                    v-for="dict in dictMap.PKG_STATUS"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="发送时间" prop="sndTime">
                <el-date-picker
                  style="width: 100%"
                  v-model="detailForm381.sndTime"
                  value-format="yyyyMMddHHmmss"
                  type="datetime"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="接收时间" prop="rcvTime">
                <el-date-picker
                  style="width: 100%"
                  v-model="detailForm381.rcvTime"
                  value-format="yyyyMMddHHmmss"
                  type="datetime"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>收付款报文确认</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="业务回执状态" prop="bizStatus">
                <el-select style="width: 100%" v-model="detailForm381.bizStatus" placeholder="业务回执状态">
                  <el-option
                    v-for="dict in dictMap.PAYEE_RT_STATUS_389"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <div v-if="this.detailForm381.bizStatus === 'PR09'">
            <el-row type="flex" v>
              <el-col :span="8">
                <el-form-item label="业务拒绝码" prop="bizRejectCode">
                  <el-input
                    v-model="detailForm381.bizRejectCode"
                    placeholder="请输入业务拒绝码"
                    @change="getbase('REJECTCODE')"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-input v-model="detailForm381.RejectCodename" :disabled="true" />
              </el-col>
              <el-col :span="4">
                <el-row>
                  <el-button type="primary" icon="el-icon-search" plain @click="openBasedataDialog('REJECTCODE')">
                    请选择
                  </el-button>
                </el-row>
              </el-col>
            </el-row>
          </div>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="业务拒绝信息" prop="bizRejectInfo">
                <el-input type="textarea" v-model="detailForm381.bizRejectInfo" maxlength="105" show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="备注" prop="remarks">
                <el-input type="textarea" v-model="detailForm381.remarks" maxlength="256" show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="附言" prop="contents">
                <el-input type="textarea" v-model="detailForm381.contents" maxlength="256" show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>
      </el-form>

      <div slot="footer" align="center" class="dialog-footer">
        <el-button type="primary" @click="save381">提 交</el-button>
        <el-button type="primary" @click="refresh381">重 置</el-button>
        <el-button type="primary" @click="cancel381">关 闭</el-button>
      </div>
    </el-dialog>

    <el-dialog
      :close-on-click-modal="false"
      :title="title382"
      :visible.sync="open382"
      center
      v-if="open382"
      append-to-body
      width="1024px"
    >
      <el-form ref="detailForm382" :model="detailForm382" :rules="rules" label-width="140px">
        <div slot="header" class="label-header-msg">
          <span></span>
        </div>
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>基本信息</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="交易流水号" prop="id">
                <el-input v-model="detailForm382.id" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="报文标识号" prop="pkgId">
                <el-input v-model="detailForm382.pkgId" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="批序号" prop="batchNo">
                <el-input v-model="detailForm382.batchNo" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="CPG日期" prop="vdate">
                <el-date-picker
                  v-model="detailForm382.vdate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="工作日期" prop="workdate">
                <el-date-picker
                  v-model="detailForm382.workdate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="来往账标识" prop="drct">
                <el-select style="width: 100%" v-model="detailForm382.drct" placeholder="来往账标识" :disabled="true">
                  <el-option
                    v-for="dict in dictMap.DRCTCODE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="业务类型" prop="bizTypeCode">
                <el-select v-model="detailForm382.bizTypeCode" placeholder="业务类型" disabled>
                  <el-option
                    v-for="dict in dictMap.BIZ_TYPE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="货币种类" prop="curcd">
                <el-input v-model="detailForm382.curcd" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="总金额" prop="totAmount">
                <ht-amount-input
                  v-model="detailForm382.totAmount"
                  placeholder="总金额"
                  :disable="true"
                ></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="回执期限" prop="returnDate">
                <el-input v-model="detailForm382.returnDate" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="收款人数目" prop="payeeNum">
                <el-input v-model="detailForm382.payeeNum" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="转发付款方日期" prop="transSenderdate">
                <el-date-picker
                  v-model="detailForm382.transSenderdate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="转发收款方日期" prop="transReceiverdate">
                <el-date-picker
                  v-model="detailForm382.transReceiverdate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="协议号" prop="protoId">
                <el-input v-model="detailForm382.protoId" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="核验标识" prop="checkId">
                <el-select style="width: 100%" v-model="detailForm382.checkId" placeholder="核验标识" :disabled="true">
                  <el-option
                    v-for="dict in dictMap.CHECKFLAG"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>付款人信息</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="付款行行号" prop="payerBrno">
                <el-input v-model="detailForm382.payerBrno" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="付款行行名" prop="payerBrname">
                <el-input v-model="detailForm382.payerBrname" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="付款清算行行号" prop="payerStBrno">
                <el-input v-model="detailForm382.payerStBrno" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="付款清算行行名" prop="payerStBrname">
                <el-input v-model="detailForm382.payerStBrname" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="付款人账号" prop="payerActno">
                <el-input v-model="detailForm382.payerActno" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="付款人名称" prop="payerName">
                <el-input v-model="detailForm382.payerName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <ht-table
              ref="dataTable"
              :multi-select="false"
              :showSerialNumber="false"
              :dictMap="dictMap"
              :queryParams="queryParams382"
              :tableBindColumns="tableBindColumns382"
              :opButtonList="opButtonList"
              :reqConfig="regConfig382"
              :showRightToolbar="false"
            />
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>收付款报文确认</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="业务回执状态" prop="bizStatus">
                <el-select style="width: 100%" v-model="detailForm382.bizStatus" placeholder="业务回执状态">
                  <el-option
                    v-for="dict in dictMap.PAYER_RT_STATUS_389"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="备注" prop="remarks">
                <el-input type="textarea" v-model="detailForm382.remarks" maxlength="256" show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="附言" prop="contents">
                <el-input type="textarea" v-model="detailForm382.contents" maxlength="256" show-word-limit />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>
      </el-form>

      <div slot="footer" align="center" class="dialog-footer">
        <el-button type="primary" @click="save382">提 交</el-button>
        <el-button type="primary" @click="refresh382">重 置</el-button>
        <el-button type="primary" @click="cancel382">关 闭</el-button>
      </div>
    </el-dialog>

    <base-data-dialog ref="basedataDialog" @confirm="confirmData"></base-data-dialog>
  </div>
</template>

<script>
import {
  apiUrlConfigEntryQuery,
  apiUrlConfigEntryQuery381,
  apiUrlConfigEntryQuery382,
  confirmCollectionPaymentEntryDetail,
  confirmCollectionPaymentEntrySave,
} from "@/api/cnaps/beps/389";
import { listPageMixin } from "@/libs/listPageMixin";
import HtAmountInput from "@/views/components/HtAmountInput";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";
import { getBasedata } from "@/api/cnaps/common/basedata";
import BaseDataDialog from "@/views/components/BasedataDialog";

export default {
  name: "RefusalCollectionPaymentEntry",
  mixins: [listPageMixin],
  components: { HtAmountInput, BaseDataDialog },
  data() {
    return {
      defaultEventKey: "defaultEventKey",
      // 查询参数
      queryParams: {
        pkgNo: undefined,
        idSeqno: undefined,
        pkgId: undefined,
        startcpgdate: undefined,
        endcpgdate: undefined,
        startworkdate: undefined,
        endworkdate: undefined,
      },
      dictMap: {},
      queryParams381: {
        id: undefined,
      },
      queryParams382: {
        id: undefined,
      },
      // 搜索
      formOptions: [],
      //
      searchFormDictList: [
        "DRCTCODE",
        "Acc_Chg_Flg_Code",
        "PROCESSSTATUS",
        "PKG_STATUS",
        "TXN_STATUS",
        "CHECKFLAG",
        "PKG_NO_381_382",
        "PAYER_RT_STATUS_389",
        "CIS_CODE",
        "BIZ_CTGY_BEPS_E102",
        "PAYEE_RT_STATUS_389",
        "BIZ_TYPE"
      ],
      // 列信息
      regConfig: apiUrlConfigEntryQuery,
      regConfig381: apiUrlConfigEntryQuery381,
      regConfig382: apiUrlConfigEntryQuery382,

      tableBindColumns: [
        { prop: "id", label: "交易流水号" },
        { prop: "vdate", label: "CPG日期", type: "date" },
        { prop: "workdate", label: "工作日期", type: "date" },
        { prop: "pkgId", label: "报文标识号" },
        { prop: "totAmount", label: "总金额", type: "price" },
        { prop: "status", label: "业务状态", dictCode: "PKG_STATUS" },
      ],

      tableBindColumns381: [
        { prop: "payerActno", label: "付款人账号" },
        { prop: "payerName", label: "付款人名称" },
        { prop: "payerBrno", label: "付款行行号" },
        { prop: "amount", label: "金额", type: "price" },
        {
          prop: "oriBizCtgyCode",
          label: "业务种类",
          formatter(row, text, index) {
            return (
              (row["oriBizCtgyCode"] === null || row["oriBizCtgyCode"] === undefined ? "" : row["oriBizCtgyCode"]) +
              "-" +
              (row["oriBizCtgyCodeDesc"] === null || row["oriBizCtgyCodeDesc"] === undefined
                ? ""
                : row["oriBizCtgyCodeDesc"])
            );
          },
        },
        { prop: "bizStatus", label: "业务状态", dictCode: "PROCESSSTATUS" },
        {
          prop: "bizRejectCode",
          label: "业务拒绝处理码",
          formatter(row, text, index) {
            return (
              (row["bizRejectCode"] === null || row["bizRejectCode"] === undefined ? "" : row["bizRejectCode"]) +
              "-" +
              (row["bizRejectCodeDesc"] === null || row["bizRejectCodeDesc"] === undefined
                ? ""
                : row["bizRejectCodeDesc"])
            );
          },
        },
      ],

      tableBindColumns382: [
        { prop: "dtlNo", label: "明细标识号" },
        { prop: "payeeActno", label: "收款人账号" },
        { prop: "payeeName", label: "收款人名称" },
        {
          prop: "bizCtgyCode",
          label: "业务种类",
          formatter(row, text, index) {
            return (
              (row["bizCtgyCode"] === null || row["bizCtgyCode"] === undefined ? "" : row["bizCtgyCode"]) +
              "-" +
              (row["bizCtgyCodeDesc"] === null || row["bizCtgyCodeDesc"] === undefined ? "" : row["bizCtgyCodeDesc"])
            );
          },
        },
        { prop: "payeeBrno", label: "收款行行号" },
        { prop: "payeeBrname", label: "收款行行名" },
        { prop: "amount", label: "金额", type: "price" },
      ],

      loading: false,
      dictMapAsync: {},
      // 弹出层标题
      title381: "",
      title382: "",
      // 是否显示弹出层
      open381: false,
      open382: false,
      // 表单参数
      detailForm381: {
        bizRejectCode: undefined,
        bizRejectInfo: undefined,
        remarks: undefined,
      },
      detailForm382: {
        bizRejectCode: undefined,
        bizRejectInfo: undefined,
        remarks: undefined,
      },

      rules: {
        bizStatus: [{ required: true, message: "请输入业务状态", trigger: "blur" }],
        bizRejectCode: [{ required: true, message: "请输入业务拒绝处理码", trigger: "blur" }],
        bizRejectInfo: [{ max: 105, message: "长度最大为105位", trigger: "blur" }],
        remarks: [{ max: 256, message: "长度最大为256位", trigger: "blur" }],
        contents: [{ max: 256, message: "长度最大为105位", trigger: "blur" }],
      },
      totalRecord: 0,
      totalPage: 0,
      needCount: 0,
    };
  },
  mounted() {
    const formOptions = [
      // 普通搜索

      {
        type: "dates",
        nameObj: {
          startTimeName: "startcpgdate",
          endTimeName: "endcpgdate",
        },
        defaultAttr: {
          size: "small",
          label: "CPG日期",
          placeholder: ["请输入CPG开始日期", "请输入CPG结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },

      {
        type: "dates",
        nameObj: {
          startTimeName: "startworkdate",
          endTimeName: "endworkdate",
        },
        defaultAttr: {
          size: "small",
          label: "工作日期",
          placeholder: ["请输入工作开始日期", "请输入工作结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },

      {
        type: "input",
        prop: "idSeqno",
        defaultAttr: {
          size: "small",
          label: "交易流水号",
          placeholder: "请输入交易流水号",
        },
      },

      {
        type: "input",
        prop: "pkgId",
        defaultAttr: {
          size: "small",
          label: "报文标识号",
          placeholder: "请输报文标识号",
        },
      },
      {
        type: "dict",
        dict: "PKG_NO_381_382",
        prop: "pkgNo",
        defaultAttr: {
          size: "small",
          label: "报文类型",
          placeholder: "请输入报文类型",
        },
      },
    ];
    this.formOptions = formOptions;
    this.dictMapAsync = this.getDictMap();
  },
  methods: {
    /***
     * 按钮操作汇总
     */
    /***
     * 按钮操作汇总
     */

    handleAction(type, row = {}) {
      switch (type) {
        case "detail":
          this.handleDetail(row);
          break;
      }
    },

    // 关闭按钮
    cancel381() {
      this.open381 = false;
    },
    // 关闭按钮
    cancel382() {
      this.open382 = false;
    },

    //点击重置按钮
    refresh381() {
      this.resetForm("detailForm381");
    },

    //点击重置按钮
    refresh382() {
      this.resetForm("detailForm382");
    },
    /** 原交易明细按钮操作 */
    handleDetail(row) {
      confirmCollectionPaymentEntryDetail(row).then((response) => {
        if ("beps.381.001.01" === row.pkgNo) {
          this.title381 = " 代收付业务收付款确认录入明细";
          this.detailForm381 = response.result;
          this.$set(this.detailForm381, "remarks1", this.detailForm381.remarks);
          this.$set(this.detailForm381, "bizStatus", "");
          this.$set(this.detailForm381, "bizRejectCode", "");
          this.$set(this.detailForm381, "RejectCodename", "");
          this.$set(this.detailForm381, "bizRejectInfo", "");
          this.$set(this.detailForm381, "remarks", "");
          this.$set(this.detailForm381, "contents", "");

          this.queryParams381.id = response.result.id;
          this.open381 = true;
        } else if ("beps.382.001.01" === row.pkgNo) {
          this.title382 = " 代收付业务收付款确认录入明细";
          this.detailForm382 = response.result;
          this.$set(this.detailForm382, "bizStatus", "");
          this.$set(this.detailForm382, "remarks", "");
          this.$set(this.detailForm382, "contents", "");
          this.queryParams382.id = response.result.id;
          this.open382 = true;
        }
      });
    },

    save381() {
      this.$refs["detailForm381"].validate((valid) => {
        if (valid) {
          confirmCollectionPaymentEntrySave(this.detailForm381)
            .then((res) => {
              this.loading = true;
              this.msgSuccess("提交成功");
              this.open381 = false;
              this.loading = false;
              this.$alert(`CORE_ID: ${res.result.rspId}`, "生成交易流水号", {
                confirmButtonText: "确定",
                callback: (action) => {
                },
              });
              this.$nextTick(() => {
                this.$refs.dataTableEntry.doQuery(true);
              });
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },

    save382() {
      this.$refs["detailForm382"].validate((valid) => {
        if (valid) {
          confirmCollectionPaymentEntrySave(this.detailForm382)
            .then((res) => {
              this.loading = true;
              this.msgSuccess("提交成功");
              this.open382 = false;
              this.loading = false;
              this.$alert(`CORE_ID: ${res.result.rspId}`, "生成交易流水号", {
                confirmButtonText: "确定",
                callback: (action) => {
                },
              });
              this.$nextTick(() => {
                this.$refs.dataTableEntry.doQuery(true);
              });
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },

    openBasedataDialog(dataType = "") {
      this.$refs.basedataDialog.show(dataType);
    },

    confirmData(fromFlag, row) {
      this.$set(this.detailForm381, "bizRejectCode", row.dataValue);
      this.$set(this.detailForm381, "RejectCodename", row.dataDesc);
    },

    //回车获取basedata值
    getbase(dataType) {
      const dataValue = this.detailForm381.bizRejectCode;
      getBasedata(dataType, dataValue)
        .then((response) => {
          if (response.code == "S" && response.result !== null) {
            this.$set(this.detailForm381, "bizRejectCode", response.result.dataValue);
            this.$set(this.detailForm381, "RejectCodename", response.result.dataDesc);
          } else {
            this.msgSuccess("找不到对应的字典项");
            this.$set(this.detailForm381, "RejectCodename", null);
          }
        })
        .catch((err) => {
          this.$set(this.detailForm, "RejectCodename", null);
        });
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
